//
//  LeftView.m
//  FormDemo
//
//  Created by zkingsoft on 16/1/5.
//  Copyright (c) 2016年 zkingsoft. All rights reserved.
//

#import "LeftView.h"

#import "LeftTableViewCell.h"

#import "CornerLineView.h"

@interface LeftView ()<UITableViewDataSource, UITableViewDelegate>

@end

@implementation LeftView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.leftTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height) style:UITableViewStylePlain];
        self.leftTableView.dataSource = self;
        self.leftTableView.delegate = self;
        self.leftTableView.rowHeight = HEIGHT;
        
        [self addSubview:self.leftTableView];
    }
    return self;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return KCOUNT;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//    LeftTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
//    if (!cell) {
            LeftTableViewCell *cell = [[LeftTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
//    }
    cell.lefFormLabel.text = [NSString stringWithFormat:@"00%ld", indexPath.row];
    cell.contentView.backgroundColor = [UIColor redColor];
    
    return cell;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    CornerLineView *cornerView = [[CornerLineView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    cornerView.backgroundColor = [UIColor whiteColor];
    
    return cornerView;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return HEIGHT;
}

@end
